package com.dbpms.pj.common.pojo;

import java.io.Serializable;

/**
 * @Author: Song Yu
 * @Date: 2020/10/15 20:47
 */
public class JsonResult implements Serializable {
    private static final long serialVersionUID = -861300715669504458L;
    private int state=1;
    private String message="ok";

    private Object data;
    public JsonResult(){};

    public JsonResult(String message){
        this.message=message;
    }
    /**查询成功时调用，封装查询结果*/
    public JsonResult(Object data) {
        this.data=data;
    }

    /**出现异常时时调用*/
    public JsonResult(Throwable t){
        this.state=0;
        this.message=t.getMessage();
    }
    public int getState() {
        return state;
    }
    public void setState(int state) {
        this.state = state;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }
}
